﻿using System;
using System.Linq;
using ForumsBrowser.BusinessObjects;
using ForumsBrowser.ServiceContracts;
using ForumsBrowser.SiteAccess;
using System.Globalization;

namespace ForumsBrowser.ObjectGateway
{
    internal static class TranslateUserAction
    {
        internal static User Execute(ForumsBrowser.DataObjects.User user)
        {
            User result = null;
            if (user != null)
            {
                result = new User()
                {
                    DisplayName = user.DisplayName,
                    MVP = user.MVP,
                    Partner = user.Partner,
                    Points = user.Points,
                    Posts = user.Posts,
                    LastActive = user.LastActive.FromXmlToDateTime().Value,
                    IsInappropriate = user.IsInappropriate,
                    Id = user.Id,
                    Answers = user.Answers,
                    Microsoft = user.Microsoft,
                    Stars = user.Stars,
                    ThreadsUrl = user.ThreadsUrl,
                    Url = user.Url,
                    Image = user.XLargeImageUrl
                };
            }

            return result;
        }
    }
}
